﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CarRent.BL.Models;
using CarRent.DAL;

namespace CarRent.BL
{
    public class CarImpl : BaseImpl
    {
        public IList<CarInfo> GetAll()
        {

            try
            {
                using (Car4RentDataContext db = new Car4RentDataContext(ConnectString))
                {
                    return db.Cars.Select(x => new CarInfo(x)).ToList();
                }
            }
            catch (Exception)
            {
                return new List<CarInfo>();
            }
        }
    }
}
